import { divide } from 'lodash'

// 兑换券、卖品券详情
export const detailList = ctx => {
  return [
    { name: '产品名称', label: 'name' },
    { name: '业务类型', label: 'businessTypeName' },
    { name: '产品类型', label: 'typeName' },
    { name: '产品类目', label: 'childCategoryName' },
    { name: '券名称', label: 'couponName' },
    { name: '产品面值(元)', label: 'parValue' },
    { name: '可用渠道', label: 'channelName' },
    { name: '兑换范围', label: 'exchangeRangeName' },
    {
      name: '解绑配置',
      render: h => {
        return [
          <span>
            {ctx.infoData.isUnbundling === '1' ? '可解绑' : '不可解绑'}
          </span>
        ]
      }
    },
    {
      name: '卡面预览',
      render: (h, row) => {
        console.log(row)
        if (!ctx.infoData.cardSurfaceImage) {
          return [<span>--</span>]
        }
        return [
          <el-image src={ctx.infoData.cardSurfaceImage} style="height: 40px; padding-top:15px; line-height:30px;" fit='contain' preview-src-list={[ctx.infoData.cardSurfaceImage]} />
        ]
      }
    },
    {
      name: '转赠配置',
      render: h => {
        return [
          <span>{ctx.infoData.isGive === '1' ? '可转赠' : '不可转赠'}</span>
        ]
      }
    },
    { name: '产品使用范围', label: 'useScopeName' },
    {
      name: '销售单类型',
      label: 'salesTypeName'
    },
    { name: '使用说明', label: 'usageRules', width: 'wp100' },
    { name: '备注', label: 'remark', width: 'wp100' },
    { name: '产品可售部门', label: 'apartmentName', width: 'wp100' }
  ]
}
// 优惠券详情
export const saleCoupon = ctx => {
  return [
    { name: '产品名称', label: 'name' },
    { name: '业务类型', label: 'businessTypeName' },
    { name: '产品类型', label: 'typeName' },
    { name: '产品类目', label: 'childCategoryName' },
    { name: '券名称', label: 'couponName' },
    {
      name: '优惠面值',
      render: h => {
        return [
          <span>
            {ctx.infoData.isDiscount === '0'
              ? `优惠券抵值金额${ctx.infoData.couponPrice}元`
              : `满${ctx.infoData.fullPrice}元减${ctx.infoData.reductionPrice
              }元`}
          </span>
        ]
      }
    },
    { name: '可用渠道', label: 'channelName' },
    { name: '兑换范围', label: 'exchangeRangeName' },
    {
      name: '解绑配置',
      render: h => {
        return [
          <span>
            {ctx.infoData.isUnbundling === '1' ? '可解绑' : '不可解绑'}
          </span>
        ]
      }
    },
    {
      name: '卡面预览',
      render: (h, row) => {
        console.log(row)
        if (!ctx.infoData.cardSurfaceImage) {
          return [<span>--</span>]
        }
        return [
          <el-image src={ctx.infoData.cardSurfaceImage} style="height: 40px; padding-top:15px; line-height:30px;" fit='contain' preview-src-list={[ctx.infoData.cardSurfaceImage]} />
          // <img src={ctx.infoData.cardSurfaceImage} style="width: 30px; height: 30px;" />
        ]
      }
    },
    {
      name: '转赠配置',
      // width: 'wp100',
      render: h => {
        return [
          <span>{ctx.infoData.isGive === '1' ? '可转赠' : '不可转赠'}</span>
        ]
      }
    },
    { name: '产品使用范围', label: 'useScopeName' },
    { name: '销售单类型', label: 'salesTypeName' },
    { name: '使用说明', label: 'usageRules', width: 'wp100' },
    { name: '备注', label: 'remark', width: 'wp100' },
    { name: '产品可售部门', label: 'apartmentName', width: 'wp100' }
  ]
}
// 点卡
export const pointCard = ctx => {
  return [
    { name: '产品名称', label: 'name' },
    { name: '业务类型', label: 'businessTypeName' },
    { name: '卡名称', label: 'cardName' },
    { name: '产品类型', label: 'typeName' },
    { name: '产品类目', label: 'childCategoryName' },
    {
      name: '是否开放充值',
      render: h => {
        return [
          <span>{ctx.infoData.isOpenRecharge === '1' ? '是' : '否'}</span>
        ]
      }
    },
    {
      name: '销售比例',
      render: h => {
        return [
          <span>
            {ctx.infoData.saleScalePrice} ：{ctx.infoData.saleScalePoint}
          </span>
        ]
      }
    },
    {
      name: '消费比例',
      render: h => {
        return [
          <span>
            {ctx.infoData.consumptionScalePrice} ：
            {ctx.infoData.consumptionScalePoint}
          </span>
        ]
      }
    },
    {
      name: '解绑配置',
      render: h => {
        return [
          <span>
            {ctx.infoData.isUnbundling === '1' ? '可解绑' : '不可解绑'}
          </span>
        ]
      }
    },
    {
      name: '卡面预览',
      render: (h, row) => {
        console.log(row)
        if (!ctx.infoData.cardSurfaceImage) {
          return [<span>--</span>]
        }
        return [
          <el-image src={ctx.infoData.cardSurfaceImage} style="height: 40px; padding-top:15px; line-height:30px;" fit='contain' preview-src-list={[ctx.infoData.cardSurfaceImage]} />

          // <img src={ctx.infoData.cardSurfaceImage} style="width: 30px; height: 30px;" />
        ]
      }
    },
    {
      name: '转赠配置',
      // width: 'wp100',
      render: h => {
        return [
          <span>{ctx.infoData.isGive === '1' ? '可转赠' : '不可转赠'}</span>
        ]
      }
    },
    { name: '产品使用范围', label: 'useScopeName' },
    {
      name: '销售单类型',
      label: 'salesTypeName'
    },
    {
      name: '使用说明',
      label: 'usageRules',
      width: 'wp100'
    },
    { name: '备注', label: 'remark', width: 'wp100' },
    { name: '产品可售部门', label: 'apartmentName', width: 'wp100' }
  ]
}
// 次卡详情
export const secondCard = ctx => {
  return [
    { name: '产品名称', label: 'name' },
    { name: '业务类型', label: 'businessTypeName' },
    { name: '产品类型', label: 'typeName', width: 'wp100' },
    { name: '产品类目', label: 'childCategoryName' },
    {
      name: '销售单类型',
      label: 'salesTypeName'
    },
    { name: '关联兑换券产品', label: 'couponProductName', width: 'wp100' },
    { name: '产品可售部门', label: 'apartmentName', width: 'wp100' }
  ]
}
